﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using skiordiecore;
using Perst;

namespace skiordie_gui
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            // get instance of the storage
Storage db = StorageFactory.Instance.CreateStorage();
// open the database
 
db.Open("test.dbs", 100000);

Root root = (Root)db.Root;// get storage root
if (root == null) {
Perst User’s Guide Page 4
// Root is not yet defined: storage is not initialized
root = new MyRootClass(db); // create root object
db.Root = root; // register root object
}

Index dictionary = (Index)db.Root; // get storage root
if (db.Root == null) {
// Root is not yet defined: storage is not initialized
db.Root = db.CreateIndex(typeof(String), // key type
                                  true); // unique index
}

 Championship obj = (Championship)db.Root["main-object"];
// and store it in the storage with specified key binding:
obj = new MyPersistentClass();
root["yet-another-object"] = obj;

    }
}
